<template>
  <el-container class="container">
    <el-aside class="nav" :width="navWidth + 'px'">
      <slot name="nav"></slot>
    </el-aside>
    <el-container class="main" :style="{ marginLeft: navWidth + 'px' }">
      <el-header>
        <slot name="head"></slot>
      </el-header>
      <el-main><slot name="main"></slot></el-main>
    </el-container>
  </el-container>
</template>

<script>
import { mapState } from "vuex";

export default {
  data() {
    return {};
  },
  computed: {
    navWidth() {
      return this.isShowAside ? 200 : 65;
    },
    ...mapState({ isShowAside: "isShowAside" }),
  },
};
</script>

<style scoped lang="less">
.container {
  .nav {
    position: fixed;
    left: 0;
    top: 0;

    border: none;

    width: 200px;
    height: 100%;
    background-color: #333;

    transition: 0.2s;
  }

  .main {
    margin-left: 200px;
    transition: 0.4s;
    min-width: 900px;
  }
}
</style>